home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-10-19 | 2.5 KB | 80 lines | [TEXT/KAHL] |
- // Prototypes
- void DrawMyWindow( void );
- void UpdateMainWindow( WindowPtr theWindow );
-
- // Globals
- Main myMain;
-
- /******************************************************************
-
- Create the main window and any additional items that need
- initialization.
-
- ******************************************************************/
- void DrawMyWindow( void )
- {
- Rect theRect;
- short cntlID, variation;
- CntlParam myParam;
-
- // create our window and give it a real catchy name.
- SetRect( &theRect, 20, 60, 300, 200 );
- myMain.window = NewCWindow( nil, &theRect, "\pCDEF - DeBugger v2.0.1", 1, 0, (WindowPtr)-1, 1, MAIN_WINDOW );
- SetPort( myMain.window );
-
- // create our control and store it in our window struct
- cntlID = 128;
- variation = 0;
- SetRect( &theRect, (*myMain.window).portRect.left + 20, (*myMain.window).portRect.top + 60,
- (*myMain.window).portRect.right - 20, (*myMain.window).portRect.top + 76 );
-
- // set up the parameters for our control
- myParam.theWindow = myMain.window;
- myParam.cntlRect = theRect;
- myParam.title[0] = 0x00;
- myParam.visible = true;
- myParam.initialValue = 0;
- myParam.min = -360;
- myParam.max = 360;
- myParam.cntlType = ( cntlID * 16 ) + variation;
-
- // now let's set up our funky control
- SetUpMyControl( myParam );
-
- // for kicks I also provided apples standard scroll bar.
- SetRect( &theRect, (*myMain.window).portRect.left + 20, (*myMain.window).portRect.top + 100,
- (*myMain.window).portRect.right - 20, (*myMain.window).portRect.top + 116 );
- myMain.hAppleControl = NewControl( myMain.window, &theRect, "\p", 1, 0, -360, 360, 16, 0L );
-
- // Update the window
- UpdateMainWindow( myMain.window );
- }
-
- /******************************************************************
-
- Draw the main window.
-
- ******************************************************************/
- void UpdateMainWindow( WindowPtr theWindow )
- {
- Rect winRect = (*theWindow).portRect;
- short strWidth, winCenter;
- Str255 theString = "\pYou should see a swell CDEF at this point.";
-
- // first erase the window.
- EraseRect( &winRect );
-
- // draw your controls
- DrawControls( myMain.window );
-
- // Add a message to remind yourself.. "Hey I should see my CDEF at this point"
- // in case your just staring at a blank window.
- TextFont( 9 );
- TextSize( 9 );
- strWidth = StringWidth( theString );
- winCenter = ( winRect.right - winRect.left ) / 2;
- MoveTo( winCenter - ( strWidth / 2 ), 20 );
- DrawString( theString );
- TextFont( 0 );
- TextSize( 12 );
- }